
package com.ami.kvm.jviewer.soc.video;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

public class VideoEngineConfigs {
	public static final int VIDEO_ENGINE_CONFIG_PKT_SIZE = 8;
	public byte differential_setting;
	public byte dct_quant_quality;
	public byte dct_quant_tbl_select;
	public byte sharp_mode_selection;
	public byte sharp_quant_quality;
	public byte sharp_quant_tbl_select;
	public byte compression_mode;
	public byte vga_dac;
	private ByteBuffer config_buf;

	public VideoEngineConfigs() {
		this.differential_setting = 0;
		this.dct_quant_quality = 0;
		this.dct_quant_tbl_select = 0;
		this.sharp_mode_selection = 0;
		this.sharp_quant_quality = 0;
		this.sharp_quant_tbl_select = 0;
		this.compression_mode = 0;
		this.vga_dac = 0;

		byte[] arrayOfByte = new byte[8];
		this.config_buf = ByteBuffer.wrap(arrayOfByte);
		this.config_buf.order(ByteOrder.LITTLE_ENDIAN);
	}

	public void setVideoEngineConfigs(ByteBuffer paramByteBuffer) {
		paramByteBuffer.rewind();
		paramByteBuffer.order(ByteOrder.LITTLE_ENDIAN);
		this.differential_setting = paramByteBuffer.get();
		this.dct_quant_quality = paramByteBuffer.get();
		this.dct_quant_tbl_select = paramByteBuffer.get();
		this.sharp_mode_selection = paramByteBuffer.get();
		this.sharp_quant_quality = paramByteBuffer.get();
		this.sharp_quant_tbl_select = paramByteBuffer.get();
		this.compression_mode = paramByteBuffer.get();
		this.vga_dac = paramByteBuffer.get();
	}

	public void setVideoEngineVGAStatus(byte paramByte) {
		this.vga_dac = paramByte;
	}

	public final int size() {
		return 8;
	}

	public final byte[] array() {
		this.config_buf.position(0);

		this.config_buf.put(this.differential_setting);
		this.config_buf.put(this.dct_quant_quality);
		this.config_buf.put(this.dct_quant_tbl_select);
		this.config_buf.put(this.sharp_mode_selection);
		this.config_buf.put(this.sharp_quant_quality);
		this.config_buf.put(this.sharp_quant_tbl_select);
		this.config_buf.put(this.compression_mode);
		this.config_buf.put(this.vga_dac);

		return this.config_buf.array();
	}
}
